# coding:utf-8


import requests

from app import BASE_URL


class EmployeeAPI:
    def __init__(self):
        self.insert_url=BASE_URL+'/api/sys/user'
        self.other_url=BASE_URL+'/api/sys/user/{}'

    def insert_e(self,staff_info,token):
        return requests.post(self.insert_url,json=staff_info,headers={'Authorization':token})

    def delete_e(self,staff_id,token):
        return requests.delete(self.other_url.format(staff_id),headers={'Authorization':token})

    def update_e(self,staff_id,token,data):
        return requests.put(self.other_url.format(staff_id),headers={'Authorization':token},json=data)

    def select_e(self,staff_id,token):
        return requests.get(self.other_url.format(staff_id),headers={'Authorization':token})